var express = require('express');
var router = express.Router();
var docdb = global.config.docdb;
var fs = require('fs');

/* GET home page. */
router.get('/', function (req, res, next) {
    docdb.find({}, function (err, docs) {
        res.render('index', {
            docs: docs
        });
    });
});

/* markdown syntax */
router.get('/syntax', function (req, res, next) {
    res.render('docs_view', {
        hidden_sidebar: true,
        doc: {
            title: 'Markdown 语法说明',
            content: fs.readFileSync(global.config.docspath + 'temp/syntax.md')
        }
    })
});

module.exports = router;




